package day09_modi.demo14_Peptides;

import java.util.Scanner;


public class Test {
    public static void main(String[] args) {
        Person person = new Person();
        System.out.println("欢迎光临宠物店");
        System.out.println("1.猫 2.狗");
        Cat cat=new Cat(3,"xiaohua","雌","波斯猫","白色");
        Dog dog=new Dog(2,"xiaojiji","雄","土狗");
        Scanner scanner=new Scanner(System.in);
        int i=scanner.nextInt();
        switch (i){
            case 1:
                person.setAnimal(cat);
                break;
            case 2:
                person.setAnimal(dog);
                break;
        }
        int health=person.getAnimal().getHealth();//获取当前宠物的健康度
        int sum = person.getAnimal().getSum();//获取当前宠物的饱食度
        System.out.println("下面开始和宠物互动");
        //给宠物喂食和玩耍
        while (health != 0 && sum != 0) {
            System.out.println("1.喂食  2.陪玩");
            int j = scanner.nextInt();
            switch (j) {
                case 1:
                    person.feed();
                    health = person.getAnimal().getHealth();//获取当前宠物的健康值
                    sum = person.getAnimal().getSum();//获取当前宠物的饱食度
                    break;
                case 2:
                    person.playing();
                    health = person.getAnimal().getHealth();//获取当前宠物的健康值
                    sum = person.getAnimal().getSum();//获取当前宠物的饱食度1
                    break;
            }
            System.out.println(health);
            System.out.println(sum);
            System.out.println("------------");
        }
    }
}
